package com.open.capacity.controller;

import com.open.capacity.common.web.Result;
import com.open.capacity.model.OrderVO;
import com.open.capacity.model.PageModel;
import com.open.capacity.service.Order2BusinessSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/order")
public class BusOrderController {

    @Autowired
    private Order2BusinessSerivce order2BusinessSerivce;

    @GetMapping("/getOrder/completed")
    public Result completed(Long id, PageModel pageModel){
        List<OrderVO> list = order2BusinessSerivce.completed(id,pageModel);
        return Result.succeed(list,"已完成订单的数据");
    }
    @GetMapping("/getOrder/completedCount")
    public Result completedCount(Long id){
        Integer count = order2BusinessSerivce.completedCount(id);
        return Result.succeed(count,"已完成订单Count");
    }

    @GetMapping("/getOrder/underway")
    public Result underway(Long id, PageModel pageModel){
        List<OrderVO> list = order2BusinessSerivce.underway(id,pageModel);
        return Result.succeed(list,"正在进行订单的数据");
    }
    @GetMapping("/getOrder/underwayCount")
    public Result underwayCount(Long id){
        Integer count = order2BusinessSerivce.underwayCount(id);
        return Result.succeed(count,"已完成订单Count");
    }

    @GetMapping("/getOrder/invalid")
    public Result invalid(Long id, PageModel pageModel){
        List<OrderVO> list = order2BusinessSerivce.invalid(id,pageModel);
        return Result.succeed(list,"失效订单的数据");
    }
    @GetMapping("/getOrder/invalidCount")
    public Result invalidCount(Long id){
        Integer count = order2BusinessSerivce.invalidCount(id);
        return Result.succeed(count,"已完成订单Count");
    }
}
